/**
 * Created by Administrator on 2018-08-06.
 * 气象分析
 */
define(function (require,exports,module) {
    var sTpl = require("./weatherAnalysis.html");
    require("./weatherAnalysis.css");
    require("../../lib/fullcalendar/moment.min.js");
    var VueComponent = Vue.extend({
        template: sTpl,
        data:function () {
            return {
                isSpecificRep:false,
                tabList:[],
                specificRep:{read:[],unRead:[]},
                rep:{read:[],unRead:[]},
                title:'',
                dialogVisible: false,
                findWeatherReport:{
                    type:'',
                    reportDate:''
                },
                pickerOptions1: {

                },

            }
        },
        methods:{
            closeNewMessage:function () {
                if(this.isSpecificRep){
                    for(var i=0;i<this.specificRep.unRead.length;i++){
                        this.specificRep.read.unshift(this.specificRep.unRead[i])
                    }
                    this.specificRep.unRead=[];
                }else{
                    for(var i=0;i<this.rep.unRead.length;i++){
                        this.rep.read.unshift(this.rep.unRead[i])
                    }
                    this.rep.unRead=[];
                }
                this.dialogVisible = false;
            },
            initMessage:function () {
                var now =  moment();
                var date = moment().minute(now.minute()-20);
                for(var i=0;i< 5;i++){
                    var time = date.minute(date.minute()-10).format("YYYY-MM-DD HH:mm:ss");

                    this.specificRep.read.push({
                        time:time,
                        messageContent:"SPECI EPDL 100029Z 06006mps 9999-SHRA \n"+
                        "FEW016 FEW026CB Q1022 RETSRA NOSIG-"
                    });
                    this.rep.read.push({
                        time:time,
                        messageContent:" ZCZC TSCXXX 120110  \n"+
                        "FF ZSCNZXZX ZSCNZQZX ZUCKZPZX-"
                    })
                }
                var time =  moment().minute(now.minute()-20).format("YYYY-MM-DD HH:mm:ss");
                this.specificRep.unRead.push({
                    time:time,
                    messageContent:"BMPEC RPGK 100029Z 06006mps 9999-SHRA \n"+
                    "FEW016 FEW026CB Q1022 RETSRA NOSIG-"
                });
                this.rep.unRead.push({
                    time:time,
                    messageContent:" KGKG TBHKKK 120110  \n"+
                    "FF ZSCNZXZX ZSCNZQZX ZUCKZPZX-"
                })
            },

            specificNewRep:function () {
                this.title="特殊气象报";
                this.tabList=this.specificRep.unRead;
                this.isSpecificRep=true;
                this.dialogVisible=true;
            },
            newRep:function () {
                this.title="气象报";
                this.tabList=this.rep.unRead;
                this.isSpecificRep=false;
                this.dialogVisible=true;
            }
        },
        watch:{
        },
        computed:{
           sRepUnRead:function () {
                return this.specificRep.unRead.length;
            },
            repUnRead:function () {
                return this.rep.unRead.length;
            }

        },
        mounted:function() {
            this.initMessage();
        },
        activated:function () {

            messages.$emit('change','气象分析');
        }
    })
    module.exports=VueComponent;
    module.exports.reDefine=function (val) {
        module.exports.type=val;
        return module.exports;
    }

})


